import request from '@/utils/request'
import type { trademarkResponseData,trademark } from './model/trademark'

enum API {
    TRADEMARKLIST = '/admin/product/baseTrademark/',  //获取品牌列表
    ADDTRADEMARK = '/admin/product/baseTrademark/save',  //添加品牌
    UPDATETRADEMARK = '/admin/product/baseTrademark/update' ,//修改品牌
    DELETETRADEMARK='/admin/product/baseTrademark/remove/'
}

//获取品牌信息接口
export const reqTradeMarkList = (page:number,limit:number)=>request.get<any,trademarkResponseData>(API.TRADEMARKLIST+`${page}/${limit}`);

//添加及新增品牌接口
export const reqAddOrUpdateTradeMark = (data: trademark) => {
    if (data.id) {
        return request.put<any,any>(API.UPDATETRADEMARK, data);
    } else {
        //新增品牌
        return request.post<any,any>(API.ADDTRADEMARK, data);
    }
}

//删除品牌
export const reqDeleteTradeMark = (id:number)=>request.delete<any,any>(API.DELETETRADEMARK+id);